package com.hue.concurrent.day04;

import java.util.concurrent.locks.LockSupport;

/*
    park和unpark:
        unpark可以在park的前后调用来使线程恢复运行
 */
public class Demo02 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            System.out.println("start...");
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            LockSupport.park();
            System.out.println("end...");
        });
        t1.start();

        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        LockSupport.unpark(t1);
    }
}
